/*------------------------------------------------------------------------------
*** PURPOSE: 	The following do-file generates Table 6 in the Appendix of the
				paper "Respondent biases in household surveys" by Andrew Dillon 
				and Edouard Romeo Mensah. 

*** NOTE:		Relevant globals are defined in the do-file titles "master.do"
				contained in the folder "02_do" in the replication package.
------------------------------------------------------------------------------*/

	
	* Table 6. Treatment effects on value of output and productivity.
	
	* Without unbalanced covariates and without gender interaction with treatment.
	* S.E. clustered at village-level: All villages included.
	
			eststo clear
			foreach i in $depvars6_app {
				reg `i' i.treat1_hhead i.treat2_rproxy, vce(cluster village)
				qui sum `i' if e(sample) & treatarm==0
				local ctrlmean=r(mean)
				local ctrlsd=r(sd)
				testparm i.treat1_hhead i.treat2_rproxy
				local pvalue_all=r(p)
				lincom 1.treat1_hhead - 1.treat2_rproxy
				local Treat1_2_coef=r(estimate)
				local Treat1_2_t=r(estimate)/r(se)
				local Treat1_2_p= tprob(r(df),abs(`Treat1_2_t'))	
				eststo `i'_A, addscalars(pvalue_all `pvalue_all' Controlmean `ctrlmean' Controlsd `ctrlsd' ///
				Treat1_2_coef `Treat1_2_coef' Treat1_2_t `Treat1_2_t' pvalue_b1_b2 `Treat1_2_p')
			}
			
			
				
			esttab *_A using "04_output\Appendix Table 6. Treatment effects on value of output and productivity.csv", se ///
			scalars("pvalue_b1_b2 p-value: test of T1=T2" "pvalue_all p-value: joint test of T1 and T2" N "Controlmean Control Mean" "Controlsd Control S.D.") sfmt(3 3 0 3 3) ///
			title("Appendix Table 6: Treatment effects on value of output and productivity") ///
			mtitles("Log value of cereal output (USD)" "Log value of legume output (USD)" "Log value of vegetable output (USD)" "Log value of food crop output (USD)" "Log value of cash crop output (USD)" "Log total value of output (USD)" "Log cereal productivity (USD/ha)" "Log legume productivity (USD/ha)" "Log vegetable productivity (USD/ha)" "Log food crop productivity (USD/ha)" "Log cash crop productivity (USD/ha)" "Log total productivity (USD/ha)") ///
			nonotes addnotes("All standard errors are clustered at the village level. *** p<0.01; ** p<0.05; * p<0.1." "Estimated without unbalanced covariates and without gender interaction with treatment.") star(* 0.1 ** 0.05 *** 0.01) ///
			coeflabels(1.treat1_hhead "T1: HH Head" 1.treat2_rproxy "T2: Random Proxy") drop(0.treat1_hhead 0.treat2_rproxy _cons) ///
			b(3) se(3) noobs width(25) replace
			
			estimates clear	
			
			
			